# GNU/Makefile for testieee754
#
# Copyright (c) 2007-2009, ben "boin" bonoeil
#
# Common targets are:
#
# o all (default) - build all
# o install       - install all
# o clean         - clean all
# o dist          - make tarball
#

project ?= testieee754
version ?= 1.0.0

prefix  ?= /usr/local
execdir ?= $(prefix)/bin

topdir  ?= ..
prjdir  ?= $(topdir)/$(project)
srcdir  ?= $(prjdir)
comdir  ?= $(topdir)/common
#incdir  ?= $(topdir)/include

DEFS     = -DVERSION='"$(version)"'
INCS     = -I. -I$(prjdir)/include -I$(topdir)/include

VPATH    = $(comdir):$(srcdir)

cfiles= \
 hl2demo_ieee754.c      \
 testieee754.c

hfiles= \
 hl2demo_ieee754.h

ofiles= $(cfiles:%.c=%.o)
dfiles= $(cfiles:%.c=%.d)

xfiles= README COPYING
target= testieee754

CPPFLAGS += $(DEFS) $(INCS)
CFLAGS   += -Wall -std=gnu99 -MMD

all: $(target)

$(target): $(ofiles)

install: $(target)
	install -s $(target) $(execdir)

dist: $(xfiles:%=$(srcdir)/%) $(cfiles:%=$(srcdir)/%) $(hfiles:%=$(incdir)/%) $(srcdir)/Makefile
	@rm -rf -- $(project)-$(version) && \
	mkdir -- \
	$(project)-$(version) \
	$(project)-$(version)/include \
	$(project)-$(version)/src && \
	cp -- $(xfiles:%=$(srcdir)/%) $(project)-$(version)/ && \
	cp -- $(cfiles:%=$(srcdir)/%) $(srcdir)/Makefilels $(project)-$(version)/src/ && \
	cp -- $(hfiles:%=$(incdir)/%) $(project)-$(version)/include/ && \
	echo OK

clean:;	rm -f -- $(ofiles) $(dfiles) $(target) 

testieee754_install:

install: testieee754_install

.PHONY: all objects install dist clean
